<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="util.*" %>
<%@ page import="model.*" %>
<%@ page import="control.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../../resources/css/admin/pages_subpage.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../../resources/js/jquery-1.3.2.js"></script>
  <script>
  	$(function(){
				//添加隔行换色
				$("tbody tr:odd").addClass("oddTR");
				
				// 添加鼠标经过样式
				$("tbody tr").mouseover(function(){
					$(this).addClass("mouseOverTR");
					$(this).children("td").each(function(){
						$(this).addClass("mouseOverTD");
						});
				});
					
				
				$("tbody tr").mouseout(function(){
					$(this).removeClass(["mouseOverTR"]);
					$(this).children("td").each(function(){
							$(this).removeClass(["mouseOverTD"]);
						});
					});
			})
			
  </script>
<title>pic list</title>
</head>
<body>
<form></form>
<form action="pic.jsp">
	  <strong>图片列表</strong>
	  <table width="500" border="0" cellpadding="0" cellspacing="0">
	  <thead>
	  <tr>
		  <th width="100">id</th>
		  <th width="100">新闻描述</th>
	      <th width="100">图片</th>
		  <th width="100">操作</th>
		  <th width="100">操作</th>
	  </tr>
	  </thead>
	<%		
	       request.setCharacterEncoding("UTF-8");
	        int pages = ParamUtil.getInt(request, "pages", 1);
			int rowsPerPage = ParamUtil.getInt(request, "pageSize", 10);
			PicNews pic = new PicNews();
			PicNewsControl pnc = new PicNewsControl();
			Collection<PicNews> list = pnc.GetAllPicNews(pages,rowsPerPage);
			Iterator<PicNews> it = list.iterator();
			while(it.hasNext()){
					pic = it.next();;
	%>
	  <tbody>
	  <tr>
		  <td align="center" ><%=pic.getId()%></td>
		  <td align="center" ><%if(pic.getContent().length()>8)out.print(pic.getContent().substring(0,8)+"...");else{out.print(pic.getContent());}%></td>
		  <td align="center" ><img src="../../../resources/photos/<%=pic.getPic()%>" alt="" width="30" height="30" /></td>
		  <td align="center">
		  <a href="pic_update.jsp?pic_id=<%= pic.getId()%> ">信息修改</a>
		  </td>
		  <td align="center">
		  <a href="pic_delet_chuli.jsp?pic_id=<%=pic.getId()%>">删除</a>
		  </td>
	  </tr>
	<%	
		   }
	%>
	</tbody>
	  </table>
    <%
			out.println(PicNewsControl.pageInstance.getToolsMenu(pages));
    %>  
  </form><p>	
          <input type="button" value="添加图片"  onclick="window.location.href='pic_add.jsp'" />
	  </p>
</body>
</html>